<?php
@ require ('writable/set/set_area.php');
if (POWER != 5) {
  err('该命令必须以基本管理员身份登陆！请重登陆');
}

if ($_GET['act'] == 'del') {

  if (file_exists('index.html')) {
    @unlink('index.html');
    echo '<span class="grayword">首页：<b>静态首页</b> - index.html 删除成功！</span><br />';
    @ob_flush();
@flush();

  }

  foreach ((array)$web['area'] as $column_id => $column) {
    $column = (array)$column;
    $column_py = $column['name'][1];
    if (file_exists($column_py.'.html')) {
      @unlink($column_py.'.html');
      echo '<span class="grayword">频道：<b>'.$column['name'][0].'</b> - '.$column_py.'.html 删除成功！</span><br />';
      @ob_flush();
@flush();

    }
    unset($column['name']);
    foreach ($column as $class_id => $class) {
      if (file_exists($column_py.'_'.$class[1].'.html')) {
        @unlink($column_py.'_'.$class[1].'.html');
	    echo '<span class="grayword">&nbsp;&nbsp;&nbsp;&nbsp;栏目：<b>'.$class[0].'</b> - '.$column_py.'_'.$class[1].'.html 删除成功！</span><br />';
        @ob_flush();
@flush();

      }
    }
  }
/*
  $all_html = @glob('./{column_*,class_*_*,detail_*_*}.html', GLOB_BRACE);

  if (count($all_html) > 0) {
    foreach ($all_html as $v) {
      @unlink($v);
    }
  }
*/


  //专题
  $priority_arr = array();
  if (!isset($sql['db_err'])) {
    $db = db_conn();
  }
  if ($sql['db_err'] == '') {

    $result = db_query($db, 'SELECT * FROM `'.$sql['pref'].''.$sql['data']['承载网址数据的表名'].'` WHERE detail_title<>"" GROUP BY detail_title');
    if ($result != false) {
      while ($row = db_fetch($db, $result)) {
        $priority_arr[$row['column_id'].'_'.$row['class_id'].'_'.$row['detail_title']] = 1;
        unset($row);
      }
    }
    $result = NULL;

  }/* else {
    $err .= $sql['db_err'];
  }*/
  db_close($db);

  unset($_GET);
  if (count($priority_arr) > 0) {
    foreach ($priority_arr as $priority_key => $priority_val) {
      list($_GET['column_id'], $_GET['class_id'], $detail_title) = @explode('_', $priority_key);
      list($_GET['detail_title'], $detail_py, ) = @explode('|', $detail_title);
      @unlink($detail_py.'.html');
	  echo '<span class="grayword">专题：<b>'.$_GET['detail_title'].'</b> - '.$detail_py.'.html 删除成功！</span><br />';
      @ob_flush();
@flush();

    }
  }

  echo '<script>
function scrollToBottom() {
  //window.scrollTo(0, document.body.offsetHeight);
  location.href="#htmlend";
}
if(document.all){
  window.attachEvent("onload",scrollToBottom);
}else{
  window.addEventListener("load",scrollToBottom,false);
}
</script>';
  alert('<a name="htmlend" id="htmlend"></a>各分类静态页面也删除成功', 'webmaster_central.php');
} else {
  @ require ('readonly/function/write_file.php');
  write_file('writable/set/set_html.php', '<?php $web[\'html\'] = false; ?>');
  $web['html'] = false;
  reset_indexhtml('index.php', 'index.html');

  err('已关闭静态（请刷新一下首页）。以首页为起始，再次进入各分类页面时为动态分类页面<br /><br /><ul style="width:50%;text-align:left;">对于各分类静态页面的处理：<li>仍然保留</li><li><a href="?post=html_close&act=del">我想全部删除它们</a></li></ul><br /><br />', 'ok');

}



?>